#include <stdio.h>

void sort(int* array, unsigned int nCnt)
{
    int value;
    int index;

    for (unsigned int i = 1; i < nCnt; i++)
    {
        value = array[i];
        index = i - 1;
        while (index >= 0 && array[index] > value)
        {
            array[index + 1] = array[index];
            index--;
        }
        array[index + 1] = value;
    }
}

int main()
{
    int array[8] = { 2,8,5,1,3,11,7,2 };

    sort(array, sizeof(array) / sizeof(int));

    for (unsigned int i = 0; i < (sizeof(array) / sizeof(int)); ++i)
        printf("%d ", array[i]);
    puts("");

    return 0;
}